<?php
require "ConnectMysql.php";

$db = connectDB();

$result = $db->query("SELECT * FROM `message` ORDER BY `created_at` DESC");

echo json_encode($result->fetch_all(MYSQLI_ASSOC));